//
//  UITextView+ZYTextViewHidden.m
//  EnjoyPlay
//
//  Created by mac on 16/4/15.
//  Copyright © 2016年 ZY. All rights reserved.
//

#import "UITextView+ZYTextViewHidden.h"

@implementation UITextView (ZYTextViewHidden)

#pragma mark 隐藏textView的键盘
- (void)textFiledHiddenkeyBord1{
    UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, self.width-50, 36)];
//    [topView setBarStyle:UIBarStyleBlack];
    
    topView.backgroundColor = [UIColor lightGrayColor];
    UIBarButtonItem * helloButton = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(dismissKeyBoard:)];
    
    UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    
    UIBarButtonItem * doneButton = [[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStyleDone target:self action:@selector(dismissKeyBoard:)];
    
    
    NSArray * buttonsArray = [NSArray arrayWithObjects:helloButton,btnSpace,doneButton,nil];
    
    [topView setItems:buttonsArray];
    [self setInputAccessoryView:topView];
}

-(void)dismissKeyBoard:(UIBarButtonItem *)item{
        [self resignFirstResponder];
    
}

@end
